<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  
<h1><?php echo $heading_title; ?></h1>
  
  <div class="content cart-info">
    
      
      <?php if ($products) { ?>
      <div class="product-filter">
         
         <select onchange="location = 'index.php?route=product/list&category_id='+this.value;">
            <option value="0"><?php echo $text_category; ?></option>
            <?php foreach ($categories as $category_1) { ?>
            <?php if ($category_1['category_id'] == $category_id) { ?>
            <option value="<?php echo $category_1['category_id']; ?>" selected="selected"><?php echo $category_1['name']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $category_1['category_id']; ?>"><?php echo $category_1['name']; ?></option>
            <?php } ?>
            <?php foreach ($category_1['children'] as $category_2) { ?>
            <?php if ($category_2['category_id'] == $category_id) { ?>
            <option value="<?php echo $category_2['category_id']; ?>" selected="selected">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $category_2['name']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $category_2['category_id']; ?>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $category_2['name']; ?></option>
            <?php } ?>
            <?php foreach ($category_2['children'] as $category_3) { ?>
            <?php if ($category_3['category_id'] == $category_id) { ?>
            <option value="<?php echo $category_3['category_id']; ?>" selected="selected">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $category_3['name']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $category_3['category_id']; ?>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $category_3['name']; ?></option>
            <?php } ?>
            <?php } ?>
            <?php } ?>
            <?php } ?>
          </select>
        
        <div class="limit"><?php echo $text_limit; ?>
          <select onchange="location = this.value;">
            <?php foreach ($limits as $limits) { ?>
            <?php if ($limits['value'] == $limit) { ?>
            <option value="<?php echo $limits['href']; ?>" selected="selected"><?php echo $limits['text']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option>
            <?php } ?>
            <?php } ?>
          </select>
        </div>
        <div class="sort"><?php echo $text_sort; ?>
          <select onchange="location = this.value;">
            <?php foreach ($sorts as $sorts) { ?>
            <?php if ($sorts['value'] == $sort . '-' . $order) { ?>
            <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
            <?php } ?>
            <?php } ?>
          </select>
        </div>
      </div>
      
      <table class="product-list" >
        <thead>
        <tr>
            <td class="pl-image">Image</td>
            <td class="pl-name">Name</td>
            <td class="pl-model">Model</td>
            <td class="pl-price">Unit price</td>
            <td class="pl-min">Units <br>per box</td>
            <td class="pl-pricetotal">Price <br>per box</td>
            <td class="pl-qu">Number <br>of boxes</td>
            <td class="pl-add" width="100">&nbsp;</td>
        </tr>
        </thead>
        <tbody>
        <?php foreach ($products as $product) { ?>
        <tr>
         <td>
          <?php if ($product['thumb']) { ?>
          <a href="<?php echo $product['href']; ?>"><img height="40" src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a>
          <?php } ?>
         </td>
         
         <td>
           <a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
         </td>
         
         <td> 
           <?php echo $product['model']; ?>
         </td>
          
         <td>
            <?php if (!$product['special']) { ?>
            <?php echo $product['price']; ?>
            <?php } else { ?>
            <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
            <?php } ?>
            <?php if ($product['tax']) { ?>
            <br />
            <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
            <?php } ?>
         </td> 
          
         
         <td>
          <?php echo $product['minimum']; ?>
         </td>
         
         <td>
          <?php echo $product['total_price']; ?>
         </td>
         
         <td>
         <input type="text" autocomplete="off" data-min-value="1" value="1" size="2" id="q<?php echo $product['product_id']; ?>"></input>
         </td>
         
         <td>
         
           <input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>',$('#q<?php echo $product['product_id']; ?>').val()*<?php echo $product['minimum']; ?>);" class="button" />
         </td>
          
        </tr>
        <?php } ?>
        </tbody>
      </table>
      <div class="pagination"><?php echo $pagination; ?></div>
  
  </div>
  
  <?php } else { ?>
  <div class="content"><?php echo $text_empty; ?></div>
  <?php }?>
  
  <?php echo $content_bottom; ?></div>
 
<?php echo $footer; ?>